#pragma once

#include "../../../src/socket/TcpIoSocket.h"
#include "../../../src/stream/SocketIoBuffer.h"
#include "../../../src/socket/TcpIoServer.h"
#include <iostream>
#include <memory>
#include <set>
#include <mutex>

namespace echo_service
{
	using namespace std;
	using namespace LibTools;

	class Session
	{
	public:
		Session(CTcpIoServer* s);
		~Session();

		void Start();

		void SetTcpServer(CTcpIoServer* server, CTcpIoSocket* svrSock);

		CTcpIoServer* GetTcpServer();

		static DWORD HandleWrite(char* data, DWORD dwSize, CSockError ec, void* invoker);

		static DWORD HandleRead(char* data, DWORD dwSize, CSockError ec, void* invoker);

	public:
		CSocketIoBuffer _readbuff;
		CSocketIoBuffer _writebuff;
		CTcpIoSocket _sock;
		CTcpIoServer *_server;
		CTcpIoSocket*_svrSock;
	};
}
